home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / AppleScript.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  5.6 KB  |  210 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        AppleScript.h
  3.  
  4.      Contains:    AppleScript Specific Interfaces.
  5.  
  6.      Version:    Technology:    AppleScript 1.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1992-1998 by Apple Computer, Inc., all rights reserved
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __APPLESCRIPT__
  18. #define __APPLESCRIPT__
  19.  
  20. #ifndef __ERRORS__
  21. #include <Errors.h>
  22. #endif
  23. #ifndef __APPLEEVENTS__
  24. #include <AppleEvents.h>
  25. #endif
  26. #ifndef __OSA__
  27. #include <OSA.h>
  28. #endif
  29. #ifndef __TEXTEDIT__
  30. #include <TextEdit.h>
  31. #endif
  32.  
  33.  
  34.  
  35. #if PRAGMA_ONCE
  36. #pragma once
  37. #endif
  38.  
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42.  
  43. #if PRAGMA_IMPORT
  44. #pragma import on
  45. #endif
  46.  
  47. #if PRAGMA_STRUCT_ALIGN
  48.     #pragma options align=mac68k
  49. #elif PRAGMA_STRUCT_PACKPUSH
  50.     #pragma pack(push, 2)
  51. #elif PRAGMA_STRUCT_PACK
  52.     #pragma pack(2)
  53. #endif
  54.  
  55. /**************************************************************************
  56.     Types and Constants
  57. **************************************************************************/
  58. /*
  59.     The specific type for the AppleScript instance of the
  60.     Open Scripting Architecture type.
  61. */
  62.  
  63. enum {
  64.     typeAppleScript                = FOUR_CHAR_CODE('ascr'),
  65.     kAppleScriptSubtype            = typeAppleScript,
  66.     typeASStorage                = typeAppleScript
  67. };
  68.  
  69. /**************************************************************************
  70.     Component Selectors
  71. **************************************************************************/
  72.  
  73.  
  74. enum {
  75.     kASSelectInit                = 0x1001,
  76.     kASSelectSetSourceStyles    = 0x1002,
  77.     kASSelectGetSourceStyles    = 0x1003,
  78.     kASSelectGetSourceStyleNames = 0x1004
  79. };
  80.  
  81.  
  82. /**************************************************************************
  83.     OSAGetScriptInfo Selectors
  84. **************************************************************************/
  85.  
  86. enum {
  87.     kASHasOpenHandler            = FOUR_CHAR_CODE('hsod')
  88. };
  89.  
  90. /*
  91.         This selector is used to query a context as to whether it contains
  92.         a handler for the kAEOpenDocuments event. This allows "applets" to be 
  93.         distinguished from "droplets."  OSAGetScriptInfo returns false if
  94.         there is no kAEOpenDocuments handler, and returns the error value 
  95.         errOSAInvalidAccess if the input is not a context.
  96.     */
  97. /**************************************************************************
  98.     Initialization
  99. **************************************************************************/
  100. EXTERN_API( OSAError )
  101. ASInit                            (ComponentInstance         scriptingComponent,
  102.                                  long                     modeFlags,
  103.                                  long                     minStackSize,
  104.                                  long                     preferredStackSize,
  105.                                  long                     maxStackSize,
  106.                                  long                     minHeapSize,
  107.                                  long                     preferredHeapSize,
  108.                                  long                     maxHeapSize)                        FIVEWORDINLINE(0x2F3C, 0x001C, 0x1001, 0x7000, 0xA82A);
  109.  
  110. /*
  111.         ComponentCallNow(kASSelectInit, 28);
  112.         This call can be used to explicitly initialize AppleScript.  If it is
  113.         not called, the a scripting size resource is looked for and used. If
  114.         there is no scripting size resource, then the constants listed below
  115.         are used.  If at any stage (the init call, the size resource, the 
  116.         defaults) any of these parameters are zero, then parameters from the
  117.         next stage are used.  ModeFlags are not currently used.
  118.         Errors:
  119.         errOSASystemError        initialization failed
  120.     */
  121. /*
  122.     These values will be used if ASInit is not called explicitly, or if any
  123.     of ASInit's parameters are zero:
  124. */
  125.  
  126. enum {
  127.     kASDefaultMinStackSize        = 4 * 1024,
  128.     kASDefaultPreferredStackSize = 16 * 1024,
  129.     kASDefaultMaxStackSize        = 16 * 1024,
  130.     kASDefaultMinHeapSize        = 4 * 1024,
  131.     kASDefaultPreferredHeapSize    = 16 * 1024,
  132.     kASDefaultMaxHeapSize        = 32L * 1024 * 1024
  133. };
  134.  
  135. /**************************************************************************
  136.     Source Styles
  137. **************************************************************************/
  138. EXTERN_API( OSAError )
  139. ASSetSourceStyles                (ComponentInstance         scriptingComponent,
  140.                                  STHandle                 sourceStyles)                        FIVEWORDINLINE(0x2F3C, 0x0004, 0x1002, 0x7000, 0xA82A);
  141.  
  142. /*
  143.         ComponentCallNow(kASSelectSetSourceStyles, 4);
  144.         Errors:
  145.         errOSASystemError        operation failed
  146.     */
  147. EXTERN_API( OSAError )
  148. ASGetSourceStyles                (ComponentInstance         scriptingComponent,
  149.                                  STHandle *                resultingSourceStyles)                FIVEWORDINLINE(0x2F3C, 0x0004, 0x1003, 0x7000, 0xA82A);
  150.  
  151. /*
  152.         ComponentCallNow(kASSelectGetSourceStyles, 4);
  153.         Errors:
  154.         errOSASystemError        operation failed
  155.     */
  156. EXTERN_API( OSAError )
  157. ASGetSourceStyleNames            (ComponentInstance         scriptingComponent,
  158.                                  long                     modeFlags,
  159.                                  AEDescList *            resultingSourceStyleNamesList)        FIVEWORDINLINE(0x2F3C, 0x0008, 0x1004, 0x7000, 0xA82A);
  160.  
  161. /*
  162.         ComponentCallNow(kASSelectGetSourceStyleNames, 8);
  163.         This call returns an AEList of styled text descriptors the names of the
  164.         source styles in the current dialect.  The order of the names corresponds
  165.         to the order of the source style constants, below.  The style of each
  166.         name is the same as the styles returned by ASGetSourceStyles.
  167.         
  168.         Errors:
  169.         errOSASystemError        operation failed
  170.     */
  171. /*
  172.     Elements of STHandle correspond to following categories of tokens, and
  173.     accessed through following index constants:
  174. */
  175.  
  176. enum {
  177.     kASSourceStyleUncompiledText = 0,
  178.     kASSourceStyleNormalText    = 1,
  179.     kASSourceStyleLanguageKeyword = 2,
  180.     kASSourceStyleApplicationKeyword = 3,
  181.     kASSourceStyleComment        = 4,
  182.     kASSourceStyleLiteral        = 5,
  183.     kASSourceStyleUserSymbol    = 6,
  184.     kASSourceStyleObjectSpecifier = 7,
  185.     kASNumberOfSourceStyles        = 8
  186. };
  187.  
  188.  
  189.  
  190. #if PRAGMA_STRUCT_ALIGN
  191.     #pragma options align=reset
  192. #elif PRAGMA_STRUCT_PACKPUSH
  193.     #pragma pack(pop)
  194. #elif PRAGMA_STRUCT_PACK
  195.     #pragma pack()
  196. #endif
  197.  
  198. #ifdef PRAGMA_IMPORT_OFF
  199. #pragma import off
  200. #elif PRAGMA_IMPORT
  201. #pragma import reset
  202. #endif
  203.  
  204. #ifdef __cplusplus
  205. }
  206. #endif
  207.  
  208. #endif /* __APPLESCRIPT__ */
  209.  
  210.